package main

/*
* Author: JacksonCoder
* CreateTime: 2025-10-02
 */
import (
	"syntax/webook/interactive/events"
	"syntax/webook/interactive/grpc"
	"syntax/webook/interactive/ioc"
	"syntax/webook/interactive/repository"
	"syntax/webook/interactive/repository/cache"
	"syntax/webook/interactive/repository/dao"
	"syntax/webook/interactive/service"
	"github.com/google/wire"
)

// Injectors from wire.go:

func InitAPP() *App {
	loggerV1 := ioc.InitLogger()
	db := ioc.InitDB(loggerV1)
	interactiveDAO := dao.NewGORMInteractiveDAO(db)
	cmdable := ioc.InitRedis()
	interactiveCache := cache.NewRedisInteractiveCache(cmdable)
	interactiveRepository := repository.NewCachedInteractiveRepository(interactiveDAO, interactiveCache, loggerV1)
	interactiveService := service.NewInteractiveService(interactiveRepository, loggerV1)
	interactiveServiceServer := grpc.NewInteractiveServiceServer(interactiveService)
	server := ioc.InitGRPCxServer(interactiveServiceServer)
	client := ioc.InitKafka()
	interactiveReadEventConsumer := events.NewInteractiveReadEventConsumer(client, loggerV1, interactiveRepository)
	v := ioc.NewConsumers(interactiveReadEventConsumer)
	app := &App{
		server:    server,
		consumers: v,
	}
	return app
}

// wire.go:

var thirdPartySet = wire.NewSet(ioc.InitDB, ioc.InitLogger, ioc.InitKafka, ioc.InitRedis)

var interactiveSvcProvider = wire.NewSet(service.NewInteractiveService, repository.NewCachedInteractiveRepository, dao.NewGORMInteractiveDAO, cache.NewRedisInteractiveCache)